package com.tj.bo.trade.client.enums;

/**
 * @program: binary-option
 * @description 交易类型
 * @author: binary
 * @create: 2020-06-05 15:07
 **/
public enum TradeTypeEnum {

    VIRTUAL_TRADE(0,"virtual trade"),
    REAL_TRADE(1, "real trade");

    private Integer code;
    private String name;

    TradeTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public TradeTypeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public TradeTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static TradeTypeEnum getEnumByCode(Integer code){
        TradeTypeEnum tradeTypeEnum = null;
        if(code != null){
            for(TradeTypeEnum typeEnum : TradeTypeEnum.values()){
                if(code == typeEnum.getCode()){
                    tradeTypeEnum = typeEnum;
                    break;
                }
            }
        }
        return tradeTypeEnum;

    }
}
